#include<iostream>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int a1[N];
LL b1[N];
LL n, t;
LL ans;
int main()
{
	cin >> n >> t;
	LL temp = 0;
	bool flag = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a1[i] >> b1[i];
	}
	for (int i = 1; i <= n; i++) {
		int a = a1[i];
		LL b = b1[i];
		if (a > t)continue;
		if (!flag) {
			if (t >= b) {
				ans += b;
				temp = b;
			}
			else {
				ans += t;
				break;	
			}
			flag = 1;
		}
		else {
			if (temp < a - a1[i - 1]) {
				
			}
		}
	}
	return 0;
}